package com.fun.feifun.modules.business.model;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fun.feifun.modules.business.constant.OrderStatusEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * <p>
 * 业务订单日志
 * </p>
 *
 * @author wkf
 * @since 2024-06-20
 */
@Data
@Accessors(chain = true)
@ApiModel(value="BusinessOrderLog对象", description="业务订单日志")
public class BusinessOrderLog  {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    public Long id;

    @ApiModelProperty(value = "序号")
    private Integer no;

    @ApiModelProperty(value = "订单状态 ")
    private Integer state;

    @ApiModelProperty(value = "状态名称")
    private String stateTitle;

    @ApiModelProperty(value = "操作情况")
    private String operationRemake;

    @ApiModelProperty(value = "备注")
    private String remake;

    @ApiModelProperty(value = "订单id")
    private Long orderId;

    @ApiModelProperty(value = "订单编号")
    private String orderCode;

    @ApiModelProperty(value = "充值目标账号")
    private String rechargeAccount;

    @ApiModelProperty(value = "路由序号")
    private Integer routeIndex;

    @ApiModelProperty(value = "匹配供货商id")
    private Long supplierId;

    @ApiModelProperty(value = "匹配供货商编码")
    private String supplierCode;

    @ApiModelProperty(value = "匹配供货商名称")
    private String supplierName;

    @ApiModelProperty(value = "匹配供货商手续费")
    private BigDecimal supplierFees;

    @ApiModelProperty(value = "商品金额")
    private BigDecimal goodsAmount;

    @ApiModelProperty(value = "平台手续金额")
    private BigDecimal feesAmount;

    /**
     * 创建时间
     */
    @JsonIgnore
    @ApiModelProperty(value = "添加时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public LocalDateTime createTime ;

    public void loadOreder(BusinessOrder order, String operationRemake, Integer no){
        this.no=no;
        this.state=order.getState();
        this.stateTitle= OrderStatusEnum.getTitleByValue(order.getState());
        this.operationRemake=operationRemake;
        this.remake=remake;
        this.orderId=order.getId();
        this.orderCode=order.getCode();
        this.rechargeAccount=order.getRechargeAccount();
        this.supplierId=order.getSupplierId();
        this.supplierCode=order.getSupplierCode();
        this.supplierName=order.getSupplierName();
        this.supplierFees=order.getSupplierFees();
        this.goodsAmount=order.getGoodsAmount();
        this.feesAmount=order.getFeesAmount();
        this.remake=order.getRemake();
    }


}
